// components/authGetUserInfo/index.js
// Component({
//     /**
//      * 组件的属性列表
//      */
//     properties: {

//     },

//     /**
//      * 组件的初始数据
//      */
//     data: {

//     },

//     /**
//      * 组件的方法列表
//      */
//     methods: {
//         getUserInfo () {
//             let app = getApp()
//             app.onGotUserInfo()
//         }
//     }
// })

// components/authGetUserInfo/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    showGetInfo: true,
    agreement: true
  },

  /**
   * 组件的方法列表
   */
  created() {
    wx.getSetting({
      withSubscriptions: true,
      success(res) {
        console.log(res)
      }
    })
  },
  methods: {
    subscribeMessage() {
      wx.requestSubscribeMessage({
        tmplIds: ['jDmMf95Y_Xr5QnUZjBTiIBI3VoCngps8uDr6TajofkI', 'VcbMXsOC2h8lQBCwVNqsGE3tbMj0WRJnKKcWLAxai1c'],
        success(res) {
          console.log(res)
          wx.getSetting({
            withSubscriptions: true,
            success(res) {
              console.log(res)
            }
          })
        },
        fail(res) {
          console.log(res)
        },
        complete(res) {
          console.log(res)
        }
      })
    },
    getUserInfo(res) {
      if (res.detail.errMsg == 'getUserInfo:ok') {
        let app = getApp()
        app.onGotUserInfo()
      }
    },
    showGetInfoSection() {
      if (!this.data.agreement) {
        wx.showToast({
          title: '请同意隐私政策与用户协议',
          icon: 'none',
          duration: 2000
        })
      } else {
        this.setData({
          showGetInfo: false
        })
      }
    },
    hideGetInfoSection() {
      this.setData({
        showGetInfo: true
      })
    },
    checkedTap: function () {
      var agreement = this.data.agreement;
      this.setData({
        "agreement": !agreement
      })
    },
    gotoAgreementInfo() {
      console.log(1)
      wx.navigateTo({
        url: "../../pages/agreementInfo/index"
      })
    }
  }
})
